
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/holonomic/operations.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:28:20 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Operations on holonomic functions &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="operations.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Converting other representations to holonomic" href="convert.html" />
    <link rel="prev" title="Representation of holonomic functions in SymPy" href="represent.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="convert.html" title="Converting other representations to holonomic"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="represent.html" title="Representation of holonomic functions in SymPy"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Holonomic</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Operations on holonomic functions</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="operations-on-holonomic-functions">
<h1>Operations on holonomic functions<a class="headerlink" href="#operations-on-holonomic-functions" title="Permalink to this headline">¶</a></h1>
<section id="addition-and-multiplication">
<h2>Addition and Multiplication<a class="headerlink" href="#addition-and-multiplication" title="Permalink to this headline">¶</a></h2>
<p>Two holonomic functions can be added or multiplied with the result also
a holonomic functions.</p>
<blockquote>
<div><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">QQ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">p</span></code> and <code class="docutils literal notranslate"><span class="pre">q</span></code> here are holonomic representation of <span class="math notranslate nohighlight">\(e^x\)</span> and
<span class="math notranslate nohighlight">\(\sin(x)\)</span> respectively.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
</pre></div>
</div>
<p>Holonomic representation of <span class="math notranslate nohighlight">\(e^x+\sin(x)\)</span></p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">+</span> <span class="n">q</span>
<span class="go">HolonomicFunction((-1) + (1)*Dx + (-1)*Dx**2 + (1)*Dx**3, x, 0, [1, 2, 1])</span>
</pre></div>
</div>
<p>Holonomic representation of <span class="math notranslate nohighlight">\(e^x \cdot \sin(x)\)</span></p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">*</span> <span class="n">q</span>
<span class="go">HolonomicFunction((2) + (-2)*Dx + (1)*Dx**2, x, 0, [0, 1])</span>
</pre></div>
</div>
</div></blockquote>
</section>
<section id="integration-and-differentiation">
<h2>Integration and Differentiation<a class="headerlink" href="#integration-and-differentiation" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.integrate">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">integrate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">limits</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initcond</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L716-L841"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.integrate" title="Permalink to this definition">¶</a></dt>
<dd><p>Integrates the given holonomic function.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">QQ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">integrate</span><span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">x</span><span class="p">))</span>  <span class="c1"># e^x - 1</span>
<span class="go">HolonomicFunction((-1)*Dx + (1)*Dx**2, x, 0, [0, 1])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span><span class="o">.</span><span class="n">integrate</span><span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">x</span><span class="p">))</span>
<span class="go">HolonomicFunction((1)*Dx + (1)*Dx**3, x, 0, [0, 1, 0])</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.diff">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">diff</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L843-L918"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.diff" title="Permalink to this definition">¶</a></dt>
<dd><p>Differentiation of the given Holonomic function.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">ZZ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">ZZ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">diff</span><span class="p">()</span><span class="o">.</span><span class="n">to_expr</span><span class="p">()</span>
<span class="go">cos(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">2</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">diff</span><span class="p">()</span><span class="o">.</span><span class="n">to_expr</span><span class="p">()</span>
<span class="go">2*exp(2*x)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.holonomic.holonomic.HolonomicFunction.integrate" title="sympy.holonomic.holonomic.HolonomicFunction.integrate"><code class="xref py py-obj docutils literal notranslate"><span class="pre">integrate</span></code></a></p>
</div>
</dd></dl>

</section>
<section id="composition-with-polynomials">
<h2>Composition with polynomials<a class="headerlink" href="#composition-with-polynomials" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.composition">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">composition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L1172-L1234"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.composition" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns function after composition of a holonomic
function with an algebraic function. The method can’t compute
initial conditions for the result by itself, so they can be also be
provided.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">QQ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">composition</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span>  <span class="c1"># e^(x**2)</span>
<span class="go">HolonomicFunction((-2*x) + (1)*Dx, x, 0, [1])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">composition</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="go">HolonomicFunction((4*x**3) + (-1)*Dx + (x)*Dx**2, x, 1, [1, 0])</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="convert.html#sympy.holonomic.holonomic.from_hyper" title="sympy.holonomic.holonomic.from_hyper"><code class="xref py py-obj docutils literal notranslate"><span class="pre">from_hyper</span></code></a></p>
</div>
</dd></dl>

</section>
<section id="convert-to-holonomic-sequence">
<h2>Convert to holonomic sequence<a class="headerlink" href="#convert-to-holonomic-sequence" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.to_sequence">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">to_sequence</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lb</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L1236-L1427"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.to_sequence" title="Permalink to this definition">¶</a></dt>
<dd><p>Finds recurrence relation for the coefficients in the series expansion
of the function about <span class="math notranslate nohighlight">\(x_0\)</span>, where <span class="math notranslate nohighlight">\(x_0\)</span> is the point at
which the initial condition is stored.</p>
<p class="rubric">Explanation</p>
<p>If the point <span class="math notranslate nohighlight">\(x_0\)</span> is ordinary, solution of the form <span class="math notranslate nohighlight">\([(R, n_0)]\)</span>
is returned. Where <span class="math notranslate nohighlight">\(R\)</span> is the recurrence relation and <span class="math notranslate nohighlight">\(n_0\)</span> is the
smallest <code class="docutils literal notranslate"><span class="pre">n</span></code> for which the recurrence holds true.</p>
<p>If the point <span class="math notranslate nohighlight">\(x_0\)</span> is regular singular, a list of solutions in
the format <span class="math notranslate nohighlight">\((R, p, n_0)\)</span> is returned, i.e. <span class="math notranslate nohighlight">\([(R, p, n_0), ... ]\)</span>.
Each tuple in this vector represents a recurrence relation <span class="math notranslate nohighlight">\(R\)</span>
associated with a root of the indicial equation <code class="docutils literal notranslate"><span class="pre">p</span></code>. Conditions of
a different format can also be provided in this case, see the
docstring of HolonomicFunction class.</p>
<p>If it’s not possible to numerically compute a initial condition,
it is returned as a symbol <span class="math notranslate nohighlight">\(C_j\)</span>, denoting the coefficient of
<span class="math notranslate nohighlight">\((x - x_0)^j\)</span> in the power series about <span class="math notranslate nohighlight">\(x_0\)</span>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">S</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">QQ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">to_sequence</span><span class="p">()</span>
<span class="go">[(HolonomicSequence((-1) + (n + 1)Sn, n), u(0) = 1, 0)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">((</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">Dx</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">to_sequence</span><span class="p">()</span>
<span class="go">[(HolonomicSequence((n**2) + (n**2 + n)Sn, n), u(0) = 0, u(1) = 1, u(2) = -1/2, 2)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="o">-</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">Dx</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">{</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">]})</span><span class="o">.</span><span class="n">to_sequence</span><span class="p">()</span>
<span class="go">[(HolonomicSequence((n), n), u(0) = 1, 1/2, 1)]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.holonomic.holonomic.HolonomicFunction.series" title="sympy.holonomic.holonomic.HolonomicFunction.series"><code class="xref py py-obj docutils literal notranslate"><span class="pre">HolonomicFunction.series</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r487"><span class="brackets"><a class="fn-backref" href="#id1">R487</a></span></dt>
<dd><p><a class="reference external" href="https://hal.inria.fr/inria-00070025/document">https://hal.inria.fr/inria-00070025/document</a></p>
</dd>
<dt class="label" id="r488"><span class="brackets"><a class="fn-backref" href="#id2">R488</a></span></dt>
<dd><p><a class="reference external" href="http://www.risc.jku.at/publications/download/risc_2244/DIPLFORM.pdf">http://www.risc.jku.at/publications/download/risc_2244/DIPLFORM.pdf</a></p>
</dd>
</dl>
</dd></dl>

</section>
<section id="series-expansion">
<h2>Series expansion<a class="headerlink" href="#series-expansion" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.series">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">series</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">6</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coefficient</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_recur</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L1643-L1733"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.series" title="Permalink to this definition">¶</a></dt>
<dd><p>Finds the power series expansion of given holonomic function about <span class="math notranslate nohighlight">\(x_0\)</span>.</p>
<p class="rubric">Explanation</p>
<p>A list of series might be returned if <span class="math notranslate nohighlight">\(x_0\)</span> is a regular point with
multiple roots of the indicial equation.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">QQ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">series</span><span class="p">()</span>  <span class="c1"># e^x</span>
<span class="go">1 + x + x**2/2 + x**3/6 + x**4/24 + x**5/120 + O(x**6)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">series</span><span class="p">(</span><span class="n">n</span><span class="o">=</span><span class="mi">8</span><span class="p">)</span>  <span class="c1"># sin(x)</span>
<span class="go">x - x**3/6 + x**5/120 - x**7/5040 + O(x**8)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.holonomic.holonomic.HolonomicFunction.to_sequence" title="sympy.holonomic.holonomic.HolonomicFunction.to_sequence"><code class="xref py py-obj docutils literal notranslate"><span class="pre">HolonomicFunction.to_sequence</span></code></a></p>
</div>
</dd></dl>

</section>
<section id="numerical-evaluation">
<h2>Numerical evaluation<a class="headerlink" href="#numerical-evaluation" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.evalf">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">evalf</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">points</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'RK4'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">h</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.05</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">derivatives</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L1775-L1848"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.evalf" title="Permalink to this definition">¶</a></dt>
<dd><p>Finds numerical value of a holonomic function using numerical methods.
(RK4 by default). A set of points (real or complex) must be provided
which will be the path for the numerical integration.</p>
<p class="rubric">Explanation</p>
<p>The path should be given as a list <span class="math notranslate nohighlight">\([x_1, x_2, ... x_n]\)</span>. The numerical
values will be computed at each point in this order
<span class="math notranslate nohighlight">\(x_1 --&gt; x_2 --&gt; x_3 ... --&gt; x_n\)</span>.</p>
<p>Returns values of the function at <span class="math notranslate nohighlight">\(x_1, x_2, ... x_n\)</span> in a list.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">QQ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>A straight line on the real axis from (0 to 1)</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">,</span> <span class="mf">0.3</span><span class="p">,</span> <span class="mf">0.4</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.6</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
</pre></div>
</div>
<p>Runge-Kutta 4th order on e^x from 0.1 to 1.
Exact solution at 1 is 2.71828182845905</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">evalf</span><span class="p">(</span><span class="n">r</span><span class="p">)</span>
<span class="go">[1.10517083333333, 1.22140257085069, 1.34985849706254, 1.49182424008069,</span>
<span class="go">1.64872063859684, 1.82211796209193, 2.01375162659678, 2.22553956329232,</span>
<span class="go">2.45960141378007, 2.71827974413517]</span>
</pre></div>
</div>
<p>Euler’s method for the same</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">evalf</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;Euler&#39;</span><span class="p">)</span>
<span class="go">[1.1, 1.21, 1.331, 1.4641, 1.61051, 1.771561, 1.9487171, 2.14358881,</span>
<span class="go">2.357947691, 2.5937424601]</span>
</pre></div>
</div>
<p>One can also observe that the value obtained using Runge-Kutta 4th order
is much more accurate than Euler’s method.</p>
</dd></dl>

</section>
<section id="convert-to-a-linear-combination-of-hypergeometric-functions">
<h2>Convert to a linear combination of hypergeometric functions<a class="headerlink" href="#convert-to-a-linear-combination-of-hypergeometric-functions" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.to_hyper">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">to_hyper</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">as_list</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_recur</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L1881-L2062"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.to_hyper" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a hypergeometric function (or linear combination of them)
representing the given holonomic function.</p>
<p class="rubric">Explanation</p>
<p>Returns an answer of the form:
<span class="math notranslate nohighlight">\(a_1 \cdot x^{b_1} \cdot{hyper()} + a_2 \cdot x^{b_2} \cdot{hyper()} ...\)</span></p>
<p>This is very useful as one can now use <code class="docutils literal notranslate"><span class="pre">hyperexpand</span></code> to find the
symbolic expressions/functions.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">ZZ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">ZZ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># sin(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">to_hyper</span><span class="p">()</span>
<span class="go">x*hyper((), (3/2,), -x**2/4)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># exp(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">to_hyper</span><span class="p">()</span>
<span class="go">hyper((), (), x)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="convert.html#sympy.holonomic.holonomic.from_hyper" title="sympy.holonomic.holonomic.from_hyper"><code class="xref py py-obj docutils literal notranslate"><span class="pre">from_hyper</span></code></a>, <a class="reference internal" href="convert.html#sympy.holonomic.holonomic.from_meijerg" title="sympy.holonomic.holonomic.from_meijerg"><code class="xref py py-obj docutils literal notranslate"><span class="pre">from_meijerg</span></code></a></p>
</div>
</dd></dl>

</section>
<section id="convert-to-a-linear-combination-of-meijer-g-functions">
<h2>Convert to a linear combination of Meijer G-functions<a class="headerlink" href="#convert-to-a-linear-combination-of-meijer-g-functions" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.to_meijerg">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">to_meijerg</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L2120-L2152"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.to_meijerg" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a linear combination of Meijer G-functions.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic</span> <span class="kn">import</span> <span class="n">expr_to_holonomic</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sin</span><span class="p">,</span> <span class="n">cos</span><span class="p">,</span> <span class="n">hyperexpand</span><span class="p">,</span> <span class="n">log</span><span class="p">,</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hyperexpand</span><span class="p">(</span><span class="n">expr_to_holonomic</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">))</span><span class="o">.</span><span class="n">to_meijerg</span><span class="p">())</span>
<span class="go">sin(x) + cos(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hyperexpand</span><span class="p">(</span><span class="n">expr_to_holonomic</span><span class="p">(</span><span class="n">log</span><span class="p">(</span><span class="n">x</span><span class="p">))</span><span class="o">.</span><span class="n">to_meijerg</span><span class="p">())</span><span class="o">.</span><span class="n">simplify</span><span class="p">()</span>
<span class="go">log(x)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.holonomic.holonomic.HolonomicFunction.to_hyper" title="sympy.holonomic.holonomic.HolonomicFunction.to_hyper"><code class="xref py py-obj docutils literal notranslate"><span class="pre">to_hyper</span></code></a></p>
</div>
</dd></dl>

</section>
<section id="convert-to-expressions">
<h2>Convert to expressions<a class="headerlink" href="#convert-to-expressions" title="Permalink to this headline">¶</a></h2>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction.to_expr">
<span class="sig-prename descclassname"><span class="pre">HolonomicFunction.</span></span><span class="sig-name descname"><span class="pre">to_expr</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L2064-L2083"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction.to_expr" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts a Holonomic Function back to elementary functions.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">ZZ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">S</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">ZZ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">Dx</span> <span class="o">+</span> <span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">])</span><span class="o">.</span><span class="n">to_expr</span><span class="p">()</span>
<span class="go">besselj(1, x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">((</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">Dx</span><span class="o">**</span><span class="mi">3</span> <span class="o">+</span> <span class="n">Dx</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">to_expr</span><span class="p">()</span>
<span class="go">x*log(x + 1) + log(x + 1) + 1</span>
</pre></div>
</div>
</dd></dl>

</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Operations on holonomic functions</a><ul>
<li><a class="reference internal" href="#addition-and-multiplication">Addition and Multiplication</a></li>
<li><a class="reference internal" href="#integration-and-differentiation">Integration and Differentiation</a></li>
<li><a class="reference internal" href="#composition-with-polynomials">Composition with polynomials</a></li>
<li><a class="reference internal" href="#convert-to-holonomic-sequence">Convert to holonomic sequence</a></li>
<li><a class="reference internal" href="#series-expansion">Series expansion</a></li>
<li><a class="reference internal" href="#numerical-evaluation">Numerical evaluation</a></li>
<li><a class="reference internal" href="#convert-to-a-linear-combination-of-hypergeometric-functions">Convert to a linear combination of hypergeometric functions</a></li>
<li><a class="reference internal" href="#convert-to-a-linear-combination-of-meijer-g-functions">Convert to a linear combination of Meijer G-functions</a></li>
<li><a class="reference internal" href="#convert-to-expressions">Convert to expressions</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="represent.html"
                        title="previous chapter">Representation of holonomic functions in SymPy</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="convert.html"
                        title="next chapter">Converting other representations to holonomic</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/holonomic/operations.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="convert.html" title="Converting other representations to holonomic"
             >next</a> |</li>
        <li class="right" >
          <a href="represent.html" title="Representation of holonomic functions in SymPy"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Holonomic</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Operations on holonomic functions</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/holonomic/operations.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:28:21 GMT -->
</html>